package com.example.K501;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.SyncStateContract.Constants;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * The first page of the app, where the user must login to their profile.
 * @author WaltonWellness
 *
 */
public class LoginActivity extends Activity {

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_login);
		
		final AccountDatabase database = new AccountDatabase();
		//Login button clicked
		ImageView Loginbutton = (ImageView) findViewById(R.id.IVLogin);
		Loginbutton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	EditText username = (EditText) findViewById(R.id.log_email);
            	EditText password = (EditText) findViewById(R.id.log_password);
            	
            	Intent i = new Intent(getApplicationContext(), DashboardActivity.class);
 		        startActivity(i);
 		        
            	//verify username and password
//                if(database.verify(username.getText().toString(), password.getText().toString()))
//                {
//                	Intent i = new Intent(getApplicationContext(), DashboardActivity.class);
//     		        startActivity(i);
//                }
//                else
//                {
//                	//Something Something wrong username/password
//                }
            }
        });
		
		ImageView registerScreen = (ImageView) findViewById(R.id.ivLoginActivityToRegister);
		registerScreen.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				 // Switching to Register screen
		        Intent i = new Intent(getApplicationContext(), RegisterActivity.class);
		        startActivity(i);
				
			}
		});
		
		ImageView forgotScreen = (ImageView) findViewById(R.id.ivLoginActivityToForgot);
		forgotScreen.setOnClickListener(new View.OnClickListener() {
			
			public void onClick(View v) {
				 // Switching to Register screen
		        Intent i = new Intent(getApplicationContext(), ForgotActivity.class);
		        startActivity(i);
				
			}
		});
	}

}
